package next.control;

import java.util.ArrayList;

import Entity.Util;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.PopupWindow;
import next.ControllerResponsibilities.*;
import next.Functionality.S_3R4_Activity;
import next.control.support.DemoPopupWindow;


public class ApplicationController extends S_3R4_Activity {

	//--Application Controller
	private static ApplicationControllerListener instance=null;
	//private static Context jndi=new InitialContext( new Properties(Util.getInitProperties()) );;
	public static enum TypeUser {ADMIN, MEMBER, CLIENT };
	private static TypeUser currentUser=TypeUser.ADMIN;
	public static boolean GOPROFILE=false;
	public static boolean BackButton=true;
	
	//--Functionality variables
	//--VOICE RECOGNITION
	public static String filterWord="";
	public static int EditTextVoice=-1;
	//--MAPS
	public static ArrayList<String> markers=new ArrayList<String>(); 
		
	//--Menu Common Variables
	public static int MenuItems=4;
    public static String [] MenuNameItems={"Home","Search","Messages", "Preferences" };
    
	//--Map Keys
	private static String keyMapDesktopPC   ="02--tT6JYa_WZoy1jbFDL7d8uS-6rNjJr3NPdPQ";
	private static String keyMapPortableSony="02--tT6JYa_WalsDp5LFWOKTTluFfYXgNuOQDWQ";
	
	//--Responsabilities
	private static C_Navigation C_Nav= new C_Navigation();
	private static Bundle b=new Bundle();
	public static PopupWindow OrderWin;
	public static PopupWindow PreferenceWin;
	public static PopupWindow SearchWin;
	
	
	public ApplicationController(){}
	
	public static ApplicationControllerListener getInstance() {
	   if (instance==null){
			instance= new ApplicationControllerListener(b );
			/*markers.add("2.352566007");	markers.add("103.78921587");
			markers.add("1.352566007");	markers.add("103.78921587");*/
			markers.add("4.627023");markers.add("-74.062703");
			
	   }
		return instance;
	}
	/**Validates if Navigation is possible to s from actual node (GUI Hierarchy)*/
	public static boolean GO (String s)
	{
		C_Navigation.setNavigation_WHERE(s);
		return ApplicationController.C_Nav.GO();
	}
	
	/**Return to father node because an activity was closed (GUI Hierarchy)*/
	public static void CLOSE ()
	{
		ApplicationController.C_Nav.CLOSE();
	}
	
	public static TypeUser getCurrentUser() {
		return currentUser;
	}

	public static void setCurrentUser(TypeUser currentUser) {
		ApplicationController.currentUser = currentUser;
	}
	/**Is called to close all the necessary activities to return up to PROFILE Activity */
	public synchronized static boolean PROFILE() {
		
		return ApplicationController.C_Nav.PROFILE();
	}

}
